From: tovisen Date: Mon, 18 Apr 2016 06:17:21 +0000 (+0200) Subject: garmin_fit: Added allpoints option to convert all points even if they do not have... X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~9^2~15^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6af4932d96f74dd7db62f172221dadbcf680654a;p=gpsbabel.git garmin_fit: Added allpoints option to convert all points even if they do not have latitude or longitude (primarily intended for devices without gps, e.g., Garmin Vivosmart HR) --- diff --git a/garmin_fit.cc b/garmin_fit.cc index c7cf88565..21ba61be3 100644 --- a/garmin_fit.cc +++ b/garmin_fit.cc @@ -26,8 +26,15 @@ #define MYNAME "fit" +static char* opt_allpoints = NULL; + static arglist_t fit_args[] = { + { + "allpoints", &opt_allpoints, + "Read all points even if latitude or longitude is missing", + NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + }, ARG_TERMINATOR }; @@ -411,13 +418,17 @@ fit_parse_data(fit_message_def* def, int time_offset) } switch (def->global_id) { case 20: // record message - if (lat == 0x7fffffff || lon == 0x7fffffff) { + if ((lat == 0x7fffffff || lon == 0x7fffffff) && !opt_allpoints) { break; } waypt = new Waypoint; - waypt->latitude = (lat / (double)0x7fffffff) * 180; - waypt->longitude = (lon / (double)0x7fffffff) * 180; + if (lat != 0x7fffffff) { + waypt->latitude = (lat / (double)0x7fffffff) * 180; + } + if (lon != 0x7fffffff) { + waypt->longitude = (lon / (double)0x7fffffff) * 180; + } if (alt != 0xffff) { waypt->altitude = (alt / 5.0) - 500; } diff --git a/reference/track/garmin-vivosmart-hr.fit b/reference/track/garmin-vivosmart-hr.fit new file mode 100755 index 000000000..91edeffc6 Binary files /dev/null and b/reference/track/garmin-vivosmart-hr.fit differ diff --git a/reference/track/garmin-vivosmart-hr.gpx b/reference/track/garmin-vivosmart-hr.gpx new file mode 100644 index 000000000..c18dfb2da --- /dev/null +++ b/reference/track/garmin-vivosmart-hr.gpx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + 81 + + + + + + + + 84 + + + + + + + + 86 + + + + + + + + 87 + + + + + + + + 88 + + + + + + + + 89 + + + + + + + + 90 + + + + + + + + 91 + + + + + + + + 92 + + + + + + + + 93 + + + + + + + + 94 + + + + + + + + 95 + + + + + + + + 96 + + + + + + + + 97 + + + + + + diff --git a/testo.d/garmin_fit.test b/testo.d/garmin_fit.test index 3a227a6c4..a6a8d6b61 100644 --- a/testo.d/garmin_fit.test +++ b/testo.d/garmin_fit.test @@ -13,3 +13,6 @@ compare ${REFERENCE}/track/garmin-edge-800-output.gpx ${TMPDIR}/fit-sample-800.g gpsbabel -i garmin_fit -f ${REFERENCE}/track/garmin-forerunner-10.fit -o gpx -F ${TMPDIR}/fit-sample-10.gpx compare ${REFERENCE}/track/garmin-forerunner-10-output.gpx ${TMPDIR}/fit-sample-10.gpx + +gpsbabel -i garmin_fit,allpoints -f ${REFERENCE}/track/garmin-vivosmart-hr.fit -o gpx,garminextensions -F ${TMPDIR}/fit-sample-vivosmart-hr.gpx +compare ${REFERENCE}/track/garmin-vivosmart-hr.gpx ${TMPDIR}/fit-sample-vivosmart-hr.gpx